package biz.obake.team.touchprotector.f;

import android.view.MotionEvent;
import biz.obake.team.touchprotector.c;
import biz.obake.team.touchprotector.f.l;
import biz.obake.team.touchprotector.g.a;
import biz.obake.team.touchprotector.g.e;
import biz.obake.team.touchprotector.tpservice.TPService;

public final class f implements l {

    /* renamed from: b  reason: collision with root package name */
    private int f1618b;

    /* renamed from: c  reason: collision with root package name */
    private long f1619c;

    /* renamed from: d  reason: collision with root package name */
    private float f1620d;
    private float e;
    private final float f = c.g(64.0f);

    private final void e() {
        String str;
        String l = a.l("five_touches_action");
        if (l != null) {
            int hashCode = l.hashCode();
            if (hashCode != -840442044) {
                if (hashCode != 3482191) {
                    if (hashCode == 110532135 && l.equals("toast")) {
                        biz.obake.team.touchprotector.log.a.b().d("FiveTouches: Toast");
                        e.c();
                        return;
                    }
                    return;
                } else if (l.equals("quit")) {
                    str = "Stop";
                } else {
                    return;
                }
            } else if (l.equals("unlock")) {
                str = "Unlock";
            } else {
                return;
            }
            TPService.k(str, "FiveTouches");
        }
    }

    private final boolean f(MotionEvent motionEvent) {
        if (motionEvent.getEventTime() - this.f1619c > ((long) 1000)) {
            return true;
        }
        float x = motionEvent.getX() - this.f1620d;
        float y = motionEvent.getY() - this.e;
        float f2 = (x * x) + (y * y);
        float f3 = this.f;
        return f2 > f3 * f3;
    }

    public void a() {
        l.a.c(this);
    }

    public boolean b(MotionEvent motionEvent) {
        d.h.b.c.c(motionEvent, "event");
        if (motionEvent.getAction() != 0) {
            return false;
        }
        if (f(motionEvent)) {
            this.f1618b = 1;
            this.f1619c = motionEvent.getEventTime();
            this.f1620d = motionEvent.getX();
            this.e = motionEvent.getY();
            return false;
        }
        this.f1618b++;
        this.f1619c = motionEvent.getEventTime();
        if (this.f1618b != 5) {
            return false;
        }
        this.f1618b = 0;
        e();
        return true;
    }

    public void c() {
        l.a.d(this);
    }

    public void d() {
        l.a.b(this);
    }
}
